<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAd extends Migration
{
    /**
     * Run the migrations.
     * 
     * @return void
     */
    public function up()
    {
        Schema::create('ad', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->foreignId("pid")
                ->references("id")->on("ad_position")
                ->comment("广告位置id")->onDelete("cascade");
            $table->string("title")->comment("广告标题");
            $table->string("descript")
                ->comment("广告描述")->nullable();
            $table->string("link")
                ->comment("广告链接")
                ->nullable();
            $table->integer('orderby')->comment("排序")
                    ->nullable()->default(0);
            $table->integer("click_count")
                ->comment("点击量")
                ->nullable()->default(0);
            //
            $table->boolean("enabled")
                ->nullable()->default(1)
                ->comment("是否开启，0否 1是");

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('ad');
    }
}
